/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logiclander.adhocracy.jira.cli;

import com.atlassian.jira.rest.client.NullProgressMonitor;
import com.atlassian.jira.rest.client.domain.BasicProject;
import com.logiclander.adhocracy.cli.CommandLineReactor;
import org.apache.commons.cli2.CommandLine;
import org.springframework.context.ApplicationContext;

/**
 *
 * @author tim
 */
public class JiraListProjectsReactorFactory extends JiraCommandLineReactorFactory {

    public JiraListProjectsReactorFactory(ApplicationContext context) {
        super(context);
    }

    public CommandLineReactor createReactor(CommandLine cl) {
        final NullProgressMonitor pm = new NullProgressMonitor();
        final Iterable<BasicProject> projects = getJiraRestClient().getProjectClient().getAllProjects(pm);
        return new JiraListProjectsReactor(projects,getJiraRestClient(),pm);
    }
}
